package dailytools.dailyui.internal.resource;

import javafx.fxml.FXMLLoader;

import java.io.IOException;
import java.net.URL;

public class FxmlUtil {

    public static FXMLLoader getFxml(Class<?> clazz) {
        URL url = clazz.getResource(String.format("/fxml/%sView.fxml", clazz.getCanonicalName()));
        FXMLLoader fxmlLoader = new FXMLLoader(url);
        try {
            fxmlLoader.load();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        return fxmlLoader;
    }
}
